package com.example.jllb;

import java.util.Arrays;

public class Size {


    public static int[] StringToInt(String[] arrs){

        int[] ints = new int[arrs.length];

        for(int i=0;i<arrs.length;i++){

            ints[i] = Integer.parseInt(arrs[i]);

        }

        return ints;

    }

    public static class NumNode
    {
        protected NumNode next = null;
        protected int num;
        public NumNode(int num)
        {
            this.num = num;
            next = null;
        }
    }
    public static void AddTrail(NumNode head, NumNode node)
    {
        //尾插法
        if ( head == null)
            head = node;
        else {
            NumNode temp = head;
            while (temp.next != null) {
                temp = temp.next;
            }
            temp.next = node;
        }
    }
    public static String PrintLink(NumNode Head) {
        NumNode node = Head;
        int[] abc=new int[10];
        for (int i=0;node != null;i++) {
            {abc[i]=node.num;
            node = node.next;}
        }
        return (Arrays.toString(abc));
    }



    public static int length(NumNode head){
        NumNode temp = head;
        int nliuyingjie=1;
        while(temp.next!=null){
            temp=temp.next;
            nliuyingjie++;
        }
        return nliuyingjie;
    }
}

